package com.itao.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Set;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * @Title: SecUser.java
 * @Description: 
 * @date 2014年2月24日 下午4:59:04
 */

public class SecUser implements UserDetails, Serializable {

	private static final long serialVersionUID = -4632342809357717092L;
	
	private String password;
    private String username;
    private Collection<GrantedAuthority> authorities;
    private boolean accountNonExpired;
    private boolean accountNonLocked;
    private boolean credentialsNonExpired;
    private boolean enabled;
    private Account account;
    
    public SecUser(Account account, Collection<GrantedAuthority> authorities){
    	this.accountNonExpired = true;
    	this.accountNonLocked = true;
    	this.credentialsNonExpired = true;
    	this.enabled = true;
    	this.username = account.getAccount();
    	this.password = account.getPassword();
    	this.authorities = authorities;
    	this.account = account;
    }

	public Collection<? extends GrantedAuthority> getAuthorities() {
		// TODO Auto-generated method stub
		return this.authorities;
	}

	public String getPassword() {
		// TODO Auto-generated method stub
		return this.password;
	}

	public String getUsername() {
		// TODO Auto-generated method stub
		return this.username;
	}

	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return this.accountNonExpired;
	}

	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return this.accountNonLocked;
	}

	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return this.credentialsNonExpired;
	}

	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return this.enabled;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

}
